using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblDoiCaUI
{ 
	private int idDoiCa;
	public int IdDoiCa
	{
		get { return idDoiCa;}
		set { idDoiCa = value;}
	}

	private int idNguoiDoi;
	public int IdNguoiDoi
	{
		get { return idNguoiDoi;}
		set { idNguoiDoi = value;}
	}

	private int idNguoiLamViec;
	public int IdNguoiLamViec
	{
		get { return idNguoiLamViec;}
		set { idNguoiLamViec = value;}
	}

	private int idCaLamViec;
	public int IdCaLamViec
	{
		get { return idCaLamViec;}
		set { idCaLamViec = value;}
	}

	private DateTime ngayLamViec;
	public DateTime NgayLamViec
	{
		get { return ngayLamViec;}
		set { ngayLamViec = value;}
	}

	public tblDoiCaUI() {}

	public tblDoiCaUI(int idDoiCa, int idNguoiDoi, int idNguoiLamViec, int idCaLamViec, DateTime ngayLamViec)
	 {
		this.idDoiCa = idDoiCa;
 		this.idNguoiDoi = idNguoiDoi;
 		this.idNguoiLamViec = idNguoiLamViec;
 		this.idCaLamViec = idCaLamViec;
 		this.ngayLamViec = ngayLamViec;
 	}

	public int Add(int idNguoiDoi, int idNguoiLamViec, int idCaLamViec, DateTime ngayLamViec)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDoiCa_Add",idNguoiDoi,idNguoiLamViec,idCaLamViec,ngayLamViec);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idDoiCa, int idNguoiDoi, int idNguoiLamViec, int idCaLamViec, DateTime ngayLamViec)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDoiCa_Update",idDoiCa,idNguoiDoi,idNguoiLamViec,idCaLamViec,ngayLamViec);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idDoiCa)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDoiCa_Delete",idDoiCa);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDoiCa_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idDoiCa)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDoiCa_Get",idDoiCa);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDoiCa_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdNguoiDoi(int idNguoiDoi)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDoiCa_GetByIdNguoiDoi",idNguoiDoi);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdNguoiLamViec(int idNguoiLamViec)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDoiCa_GetByIdNguoiLamViec",idNguoiLamViec);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetByIdCaLamViec(int idCaLamViec)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDoiCa_GetByIdCaLamViec",idCaLamViec);
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
